// ignore_for_file: non_constant_identifier_names

import 'package:analyzer/dart/ast/ast.dart';
import 'package:dart_bean/cass_info.dart';
import 'package:dart_bean/util/field_feature.dart';

class FieldInfo {
  final CassInfo parent;
  final FieldDeclaration self;
  final String type;
  late String baseType;
  final String name;
  final Map<Type, dynamic> buffers = {};

  FieldInfo(this.parent, this.self, this.type, this.name);

  late final _feature = MediatorFieldFeature.it;

  late final bool isIgnoreDeserialize = _feature.isIgnoreDeserialize(this);

  late final bool isIgnoreSerialize = _feature.isIgnoreSerialize(this);

  late final String? jsonName = _feature.getJsonName(this);

  String toJsonRightValue(String instance) {
    return _feature.mergeToJsonRightValue(this, instance, type);
  }

  String getConvert() {
    return _feature.getConvert(this);
  }

  late final bool hasDefaultValue = self.toString().contains(RegExp(' $name = '));
}
